Merge "HTMLCheckMatrix support for forcing options on/off"
[lhc/web/wiklou.git] / tests / phpunit / includes / GlobalFunctions / GlobalWithDBTest.php
1 <?php
2
3 /**
4 * @group Database
5 */
6 class GlobalWithDBTest extends MediaWikiTestCase {
7 /**
8 * @dataProvider provideWfIsBadImageList
9 */
10 function testWfIsBadImage( $name, $title, $blacklist, $expected, $desc ) {
11 $this->assertEquals( $expected, wfIsBadImage( $name, $title, $blacklist ), $desc );
12 }
13
14 public static function provideWfIsBadImageList() {
15 $blacklist = '* [[File:Bad.jpg]] except [[Nasty page]]';
16
17 return array(
18 array( 'Bad.jpg', false, $blacklist, true,
19 'Called on a bad image' ),
20 array( 'Bad.jpg', Title::makeTitle( NS_MAIN, 'A page' ), $blacklist, true,
21 'Called on a bad image' ),
22 array( 'NotBad.jpg', false, $blacklist, false,
23 'Called on a non-bad image' ),
24 array( 'Bad.jpg', Title::makeTitle( NS_MAIN, 'Nasty page' ), $blacklist, false,
25 'Called on a bad image but is on a whitelisted page' ),
26 array( 'File:Bad.jpg', false, $blacklist, false,
27 'Called on a bad image with File:' ),
28 );
29 }
30 }